package tianhaodata.integration.api.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tianhaodata.integration.api.mapper.MembersRepository;
import tianhaodata.integration.api.repository.entity.InteQuery;
import tianhaodata.integration.api.repository.entity.MembersEntity;
import tianhaodata.integration.api.service.MembersService;

import java.util.List;

@Service
public class MembersServiceImpl implements MembersService {
    @Autowired
    MembersRepository membersRepository;

    @Override
    public List<MembersEntity> searchMembersList() {
//        PageHelper.startPage(1, 3);
        List<MembersEntity> entities = membersRepository.searchMembersList();
//        PageInfo<MembersEntity> pageInfo = new PageInfo<>(entities);
        return entities;
    }

    public PageInfo<MembersEntity> searchMembersListByName(InteQuery inteQuery) {
        PageHelper.startPage(inteQuery.getPageNum(), inteQuery.getPageSize());
        return new PageInfo<MembersEntity>(membersRepository.searchMembersListByName(inteQuery));
    }

}
